//package com.game.manager.config;
//
//import com.game.manager.security.JwtTokenFilter;
//import lombok.AllArgsConstructor;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.HttpMethod;
//import org.springframework.security.authentication.AuthenticationManager;
//import org.springframework.security.authentication.AuthenticationProvider;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.builders.WebSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.web.SecurityFilterChain;
//import org.springframework.security.web.access.intercept.AuthorizationFilter;
//
//@Configuration
//@AllArgsConstructor
//@EnableWebSecurity(debug = true)
//@EnableGlobalMethodSecurity(prePostEnabled = true)
//public class GmWebSecurityConfig {
//    private AuthenticationProvider authProvider;
//    private JwtTokenFilter jwtTokenFilter;
//
//    @Bean
//    public void configure(WebSecurity webSecurity) {
//        // 把静态资源和登陆页面忽略掉，不进行权限验证
//        webSecurity.ignoring().antMatchers(HttpMethod.GET,
//                "/",
//                "/**",
//                "/favicon.ico",
//                "/gm/layout/index",
//                "/layout/index",
//                "/gm/user/login",
//                "/user/login",
//                "/gm/account/login",
//                "/account/login",
//                "/statics/**",
//                "/statics/jquery.min.js",
//                "/statics/easyui/**",
//                "/statics/easyui/*.js",
//                "/statics/layui/**",
//                "/statics/layui/*.js",
//                "/statics/server-option/**",
//                "/statics/server-option/*.js",
//                "/statics/images/*.jpg",
//                "/jquery.min.js",
//                "/easyui/**",
//                "/easyui/*.js",
//                "/layui/**",
//                "/layui/*.js",
//                "/server-option/**",
//                "/server-option/*.js",
//                "/images/*.jpg",
//                "/templates/**",
//                "/templates/*.html",
//                "/templates/dev/*.html",
//                "/templates/system/*.html",
//                "/*.html",
//                "/dev/*.html",
//                "/system/*.html",
//                "/**/*.html",
//                "/**/*.css",
//                "/**/*.js",
//                "/**/*.jpg");
//    }
//
//    @Bean
//    protected SecurityFilterChain configure(HttpSecurity http) throws Exception {
//        http.csrf().disable()
//                .sessionManagement().disable()
//                .authorizeHttpRequests()
//                .antMatchers("/gm/layout/*","/gm/account/*","/gm/user/*").permitAll()
//                .antMatchers("/layout/*","/account/*","/user/*").permitAll()
//                .anyRequest().authenticated();
//
//        http.addFilterBefore(jwtTokenFilter, AuthorizationFilter.class);
//        return http.build();
//    }
//
//    @Bean
//    public AuthenticationManager authenticationManager(HttpSecurity http) throws Exception {
//        AuthenticationManagerBuilder authenticationManagerBuilder = http.getSharedObject(AuthenticationManagerBuilder.class);
//        authenticationManagerBuilder.authenticationProvider(authProvider);
//        return authenticationManagerBuilder.build();
//    }
//}